package com.tanhua.dubbo.api;

import com.tanhua.model.db.MovementTimeLine;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;


import java.util.List;

/**
 * @auther : 白月尘
 * @date : 15:19  2021/10/21
 */
@DubboService
public class MovementTimeLineApiImpl implements MovementTimeLineApi {
    @Autowired
    private MongoTemplate mongoTemplate;

    @Override
    public void save(String textContent, String upload) {

    }

    @Override
    public List<MovementTimeLine> findByFriendId(Integer page, Integer pageSize, long userId) {
        Query query = Query.query(Criteria.where("userId").is(userId));
        List<MovementTimeLine> movementTimeLines = mongoTemplate.find(query, MovementTimeLine.class);
        return movementTimeLines;
    }
}
